package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Meet;
import com.ruoyi.system.service.IMeetService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.vo.MeetVO;

/**
 * 会议信息管理Controller
 *
 * @author ruoyi
 * @date 2025-01-09
 */
@RestController
@RequestMapping("/system/meet")
public class MeetController extends BaseController
{
    @Autowired
    private IMeetService meetService;

    /**
     * 查询会议信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:meet:list')")
    @GetMapping("/list")
    public TableDataInfo list(Meet meet)
    {
        startPage();
        List<Meet> list = meetService.selectMeetList(meet);
        return getDataTable(list);
    }

    /**
     * 导出会议信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:meet:export')")
    @Log(title = "会议信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Meet meet)
    {
        List<Meet> list = meetService.selectMeetList(meet);
        ExcelUtil<Meet> util = new ExcelUtil<Meet>(Meet.class);
        util.exportExcel(response, list, "会议信息管理数据");
    }

    /**
     * 获取会议信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:meet:query')")
    @GetMapping(value = "/{meetId}")
    public AjaxResult getInfo(@PathVariable("meetId") Integer meetId)
    {
        return success(meetService.selectMeetByMeetId(meetId));
    }

    /**
     * 新增会议信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:meet:add')")
    @Log(title = "会议信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Meet meet)
    {
        return toAjax(meetService.insertMeet(meet));
    }

    /**
     * 修改会议信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:meet:edit')")
    @Log(title = "会议信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Meet meet)
    {
        return toAjax(meetService.updateMeet(meet));
    }

    /**
     * 删除会议信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:meet:remove')")
    @Log(title = "会议信息管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{meetIds}")
    public AjaxResult remove(@PathVariable Integer[] meetIds)
    {
        return toAjax(meetService.deleteMeetByMeetIds(meetIds));
    }

    /**
     * 查询会议详细信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:meet:list')")
    @GetMapping("/listDetails")
    public TableDataInfo listDetails(Meet meet) {
        startPage();
        List<MeetVO> list = meetService.selectMeetVOList(meet);
        return getDataTable(list);
    }
}
